import requests
from config import url, headers_web


class PreparationCourseBag:
    def __init__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_teacher_course_resources(cls, url: str, headers=headers_web, params=None, paramspath=None):
        """
        Summary:接口-老师查看课程结构下资源列表
        Description:1.云课堂老师端备课包管理使用
        :param url:
        :param headers:
        :param params:
        :param paramspath:
        :return:
        """
        url = url + f"/courseApi/v1/preparationcoursebag/{paramspath}/courseresources"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_page_redirection(cls, url: str, headers=headers_web, params=None, paramspath=None):
        """
        Summary:接口-发布跳转，获取老师当前学期或下个学期的课程相关信息
        Description:1.云课堂老师端备课包管理发布使用
        :param url:
        :param headers:
        :param params:
        :param paramspath:
        :return:
        """
        url = url + f"/courseApi/v1/preparationcoursebag/{paramspath}/teacherCourse"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_update_pubilc_status(cls, url: str, headers=headers_web, params=None, json=None):
        """
        Summary:接口-更新备课包资源公开状态
        Description:调用方：1、云课堂管理web端—备课包教学资源
        :param url:
        :param headers:
        :param params:
        :param json:
        :return:
        """
        url = url + f"/courseApi/v1/preparationcoursebag/teachingfiles"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r
